let path = require('path');
let fs = require('fs');
let open = require('open');
let express = require('express');
let app = express();

function start(port = 2333, {
  staticPath = './',
  page = ''
} = options) {
  app.use(express.static(staticPath));

  let server = app.listen(port, '127.0.0.1', () => {
    let serverPath = `http://${server.address().address}:${server.address().port}`;
    console.log(`访问地址为 ${serverPath}`);

    open(`${serverPath}/${page}`);
  });
}

module.exports = start;
